In [1]:
%matplotlib inline
In [2]:
from bigbang.archive import Archive
In [3]:
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import numpy as np
import math
import networkx as nx
Now let's load the data for analysis.
In [4]:
urls = ["ipython-dev",
"ipython-user"]
archives = [Archive(url,archive_dir="../../archives",mbox=True) for url in urls]
activities = [arx.get_activity(resolved=False) for arx in archives]
In [ ]:
G = nx.Graph()
labels = {}
for i, url in enumerate(urls):
G.add_node(url,type='url')
labels[url] = url
for person in archives[i].data['From'].drop_duplicates():
G.add_node(person,type='person')
G.add_edge(person,url)
colors = [.1 if nd[1]['type'] == 'url' else .5 for nd in list(G.nodes(data=True))]
sizes = [300 if nd[1]['type'] == 'url' else 5 for nd in list(G.nodes(data=True))]
nx.draw(G,
node_color=colors,
labels=labels)
In [7]:
nx.write_gexf(G,'bipartite.gexf')